package com.money.tracker.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.concurrent.TimeUnit;

/**
 * <p>
 *
 * <p>
 *
 * @author zhangshuai
 * &#064;@date 2024/09/21
 */
@Getter
@AllArgsConstructor
public enum RedisKeyEnum {
    CAPTCHA_CODE_KEY("captcha:codes:", "验证码key", 2, TimeUnit.MINUTES),
    CACHE_KEY("cache:", "字典常量", 240, TimeUnit.HOURS),
    SYS_CONFIG_KEY("config:", "配置常量", 240, TimeUnit.HOURS),
    PWD_ERR_CNT_KEY("pwd_err_cnt:", "密码错误次数", 10, TimeUnit.MINUTES),
    KEY_DEPT("dept:", "部门", 240, TimeUnit.HOURS),
    CAPTCHA("captcha:", "验证码", 3, TimeUnit.MINUTES);
    ;

    private final String key;
    private final String desc;
    private final Integer expire;
    private final TimeUnit timeUnit;


    public static String getKey(RedisKeyEnum keyEnum, Object key) {
        return keyEnum.getKey() + key;
    }

}
